home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / PROGRAMMING / DESKLIBC / SOURCES.ZIP / DeskLib / !DLSources / Libraries / Handler / c / HtchRedraw < prev    next >
Text File  |  1995-07-08  |  2KB  |  61 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Handler.HtchRedraw.c
  12.     Author:  Copyright © 1993 Mark H. Wilkinson
  13.     Version: 1.00 (28 Sept 1993)
  14.     Purpose: Hatch the work area of a window. Useful when testing
  15.              a program before you get round to writing your own redraw
  16.              routines so you can see that something is happening.
  17. */
  18.  
  19.  
  20. #include "DeskLib:WimpSWIS.h"
  21. #include "DeskLib:GFX.h"
  22. #include "DeskLib:Handler.h"
  23.  
  24. #define hatch_size 48
  25.  
  26. extern BOOL Handler_HatchRedraw(event_pollblock *event, void *reference)
  27. {
  28.   window_redrawblock redraw;
  29.   BOOL more;
  30.   int origin_x, origin_y;
  31.   int xstart, height, xcorr, ycorr, x;
  32.  
  33.   UNUSED( reference);
  34.   
  35.   redraw.window = event->data.openblock.window;
  36.   Wimp_RedrawWindow(&redraw, &more);
  37.   origin_x = redraw.rect.min.x - redraw.scroll.x;
  38.   origin_y = redraw.rect.max.y - redraw.scroll.y;
  39.  
  40.   while (more)
  41.   {
  42.     height = redraw.cliprect.max.y - redraw.cliprect.min.y;
  43.     xstart = redraw.cliprect.min.x - height;
  44.     xcorr = (xstart - origin_x) % hatch_size;
  45.     ycorr = (origin_y - redraw.cliprect.min.y) % hatch_size;
  46.     for (x = xstart-xcorr-ycorr; x < redraw.cliprect.max.x; x += hatch_size) {
  47.       GFX_Move(x, redraw.cliprect.min.y);
  48.       GFX_DrawBy(height, height);
  49.     }
  50.     ycorr = (origin_y - redraw.cliprect.max.y) % hatch_size;
  51.     for (x = xstart-xcorr+ycorr-hatch_size; x < redraw.cliprect.max.x; x += hatch_size) {
  52.       GFX_Move(x, redraw.cliprect.max.y-1);
  53.       GFX_DrawBy(height, -height);
  54.     }
  55.  
  56.     Wimp_GetRectangle(&redraw, &more);
  57.   }
  58.  
  59.   return(TRUE);
  60. }
  61.